﻿var speed = 3.0;
var mainCamera:Camera;
var fire_smallPrefab:Transform;
var fire_bigPrefab:Transform;
var holdingTime;
var x = Screen.width / 2;
var y = Screen.height / 2;

function  Update(){

if(Input.GetButtonDown("Fire1"))
{	

		holdingTime = Time.time;	
}		
		if(Input.GetButtonUp("Fire1"))
		{
			
			if (Time.time < holdingTime + 3.0)
			{
				var ray1:Ray = mainCamera.ScreenPointToRay(Vector3 (x, y, 0));
				
				var fire1 = Instantiate(fire_smallPrefab, transform.position, Quaternion.identity);
	 			fire1.rigidbody.AddForce(ray1.direction * 100, ForceMode.Impulse );
				
			}	
	
    			
 			else
 			{		
 				var ray2:Ray  = mainCamera.ScreenPointToRay(Vector3 (x, y, 0));
				
				var fire2 = Instantiate(fire_bigPrefab, transform.position, Quaternion.identity);
	 			fire2.rigidbody.AddForce(ray2.direction * 80, ForceMode.Impulse );
	 			
 			}	
	
}
}